-
-
Notifications
You must be signed in to change notification settings - Fork 226
SentryGraphQLHttpFailedRequestHandler improved issue grouping. #4762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SentryGraphQLHttpFailedRequestHandler improved issue grouping. #4762
Conversation
| #endif | ||
| // Wrap in a new exception to preserve the stack trace when thrown and caught. | ||
| // The inner exception will have the full stack trace for better issue grouping. | ||
| throw new GraphQLHttpRequestException(errorMessage, exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Inner exception missing stack trace on pre-.NET 5
On pre-.NET 5 platforms, the inner exception won't have a stack trace because it's never thrown and SetCurrentStackTrace isn't available. The wrapper exception at line 45 only captures a minimal stack trace from the immediate throw/catch within the same method. To match the HTTP handler pattern, the inner exception should be thrown and caught on pre-.NET 5 platforms before wrapping, similar to the try-catch pattern used in SentryHttpFailedRequestHandler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's something weird about wrapping an exception that we just created (on line 36) in another identical exception.
Could we do this the same way as the other handler:
sentry-dotnet/src/Sentry/SentryHttpFailedRequestHandler.cs
Lines 40 to 54 in ab2d7c4
| #if NET5_0_OR_GREATER | |
| // Add a full stack trace into the exception to improve Issue grouping, | |
| // see https://github.com/getsentry/sentry-dotnet/issues/3582 | |
| ExceptionDispatchInfo.SetCurrentStackTrace(exception); | |
| #else | |
| // Where SetRemoteStackTrace is not available, throw and catch to get a basic stack trace | |
| try | |
| { | |
| throw exception; | |
| } | |
| catch (HttpRequestException ex) | |
| { | |
| exception = ex; | |
| } | |
| #endif |
Applies the same improvements for GraphQL as in this PR for plain HTTP: #4724